package com.example.yuan520.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

@TableName("student")
public class Student {
    @TableId(type = IdType.AUTO)
    private Integer id;             // 学生ID（主键，自增）
    private String studentName;     // 学生姓名
    private Integer age;            // 学生年龄
    private String gender;          // 学生性别（男/女）
    private String major;           // 学生专业

    // 无参构造方法（alt+insert -> Constructor -> 空构造）
    public Student() {
    }

    // 全参构造方法（alt+insert -> Constructor -> 选中所有字段）
    public Student(Integer id, String studentName, Integer age, String gender, String major) {
        this.id = id;
        this.studentName = studentName;
        this.age = age;
        this.gender = gender;
        this.major = major;
    }

    // getter方法（alt+insert -> Getter -> 全选字段）
    public Integer getId() {
        return id;
    }

    public String getStudentName() {
        return studentName;
    }

    public Integer getAge() {
        return age;
    }

    public String getGender() {
        return gender;
    }

    public String getMajor() {
        return major;
    }

    // setter方法（alt+insert -> Setter -> 全选字段）
    public void setId(Integer id) {
        this.id = id;
    }

    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    // toString方法（alt+insert -> toString() -> 全选字段）
    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", studentName='" + studentName + '\'' +
                ", age=" + age +
                ", gender='" + gender + '\'' +
                ", major='" + major + '\'' +
                '}';
    }
}